﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin.master" AutoEventWireup="true" CodeFile="DeNghiTamUng.aspx.cs" Inherits="DeNghiTamUng" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:UpdatePanel ID="up1" runat="server">
        <ContentTemplate>
            <div class="panel panel-success margin">
                <div class="panel-heading">
                    <h3 class="panel-title">
                        Đề nghị tạm ứng</h3>
                </div>
                <div class="panel-body">
                    <table width="100%">
                        <tr>
                            <td>
                                <span style="margin-left: 5px;">Số</span><br /> 
                                <asp:TextBox ID="txtSo" ReadOnly="true" runat="server" CssClass="form-control withall"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <span style="margin-left: 5px;">Người đề nghị tạm ứng</span><br />
                                <asp:TextBox ID="txtnguoidenghi" runat="server" CssClass="form-control withall" 
                                    ReadOnly="True"></asp:TextBox>
                                
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <span style="margin-left: 5px;">Chức vụ</span><br />
                                <asp:TextBox ID="txtchucvu" runat="server" CssClass="form-control withall" 
                                    ReadOnly="True"></asp:TextBox>
                                
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <span style="margin-left: 5px;">Bộ phận</span><br />
                                <asp:TextBox ID="txtbophan" runat="server" CssClass="form-control withall" 
                                    ReadOnly="True"></asp:TextBox>
                               
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <span style="margin-left: 5px;">Số tiền</span><br />
                                <asp:TextBox ID="txtsotien"   runat="server" CssClass="form-control withall" AutoPostBack="true"
                                    ontextchanged="txtsotien_TextChanged"></asp:TextBox>
                                <asp:RequiredFieldValidator ValidationGroup="Them" ID="RequiredFieldValidator4" runat="server"
                                    ControlToValidate="txtsotien" ErrorMessage="Nhập số tiền" Display="None" Text="*"></asp:RequiredFieldValidator>
                                    <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender1" runat="server" FilterType="Numbers"
                                    TargetControlID="txtsotien" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <span style="margin-left: 5px;">Viết bằng chữ</span><br />
                                <asp:TextBox ID="txtvietbangchu" runat="server" CssClass="form-control withall" Enabled="false"></asp:TextBox>
                                
                                
                            </td>
                        </tr>
                         <tr>
                            <td>
                                <span style="margin-left: 5px;">Lí do tạm ứng</span><br />
                                <asp:TextBox ID="txtlido" TextMode="MultiLine" Height="100px" runat="server" CssClass="form-control withall"></asp:TextBox>
                                <asp:RequiredFieldValidator ValidationGroup="Them" ID="RequiredFieldValidator1" runat="server"
                                    ControlToValidate="txtlido" ErrorMessage="Nhập lí do tạm ứng" Display="None"
                                    Text="*"></asp:RequiredFieldValidator>
                                
                            </td>
                        </tr>
                       
                         <tr>
                            <td>
                                <span style="margin-left: 5px;">Hình thức thanh toán<br />
                                    <asp:RadioButton ID="cktienmat" runat="server" Text="Nhận tiền mặt"  
                                    Checked="true" GroupName="NhanTien" 
                                    oncheckedchanged="cktienmat_CheckedChanged" AutoPostBack="true"/>
                                     <asp:RadioButton ID="ckchuyenkhoan" runat="server" Text="Chuyển khoản" 
                                    GroupName="NhanTien" oncheckedchanged="ckchuyenkhoan_CheckedChanged" AutoPostBack="true"/>
                                    </span>
                            </td>
                        </tr>
                         <tr>
                            <td>
                                <span style="margin-left: 5px;"><asp:Label runat="server" Visible="false" ID="lbchutaikhoan" Text="Chủ tài khoản"></asp:Label></span><br />
                                <asp:TextBox ID="txtchutaikhoan"  Visible="false" runat="server" CssClass="form-control withall"></asp:TextBox>
                                <asp:RequiredFieldValidator ValidationGroup="Them" ID="RequiredFieldValidator2" runat="server"
                                    ControlToValidate="txtchutaikhoan" ErrorMessage="Nhập chủ tài khoản" Display="None"
                                    Text="*"></asp:RequiredFieldValidator>
                                
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <span style="margin-left: 5px;"><asp:Label runat="server" Visible="false" ID="lbsotaikhoan" Text="Số tài khoản"></asp:Label></span><br />
                                <asp:TextBox ID="txtsotaikhoan"  Visible="false" runat="server" CssClass="form-control withall"></asp:TextBox>
                                <asp:RequiredFieldValidator ValidationGroup="Them" ID="RequiredFieldValidator3" runat="server"
                                    ControlToValidate="txtsotaikhoan" ErrorMessage="Nhập so tài khoản" Display="None"
                                    Text="*"></asp:RequiredFieldValidator>
                                
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <span style="margin-left: 5px;"><asp:Label runat="server" Visible="false" ID="lbnganhang" Text="Ngân hàng"></asp:Label></span><br />
                                <asp:TextBox ID="txtnganhang"  Visible="false" runat="server" CssClass="form-control withall"></asp:TextBox>
                                <asp:RequiredFieldValidator ValidationGroup="Them" ID="RequiredFieldValidator6" runat="server"
                                    ControlToValidate="txtnganhang" ErrorMessage="Nhập ngân hàng" Display="None"
                                    Text="*"></asp:RequiredFieldValidator>
                                
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <span style="margin-left: 5px;"><asp:Label runat="server" Visible="false" ID="lbchinhanh" Text="Chi nhánh"></asp:Label></span><br />
                                <asp:TextBox ID="txtchinhanh"  Visible="false" runat="server" CssClass="form-control withall"></asp:TextBox>
                                <asp:RequiredFieldValidator ValidationGroup="Them" ID="RequiredFieldValidator7" runat="server"
                                    ControlToValidate="txtchinhanh" ErrorMessage="Nhập chi nhánh" Display="None"
                                    Text="*"></asp:RequiredFieldValidator>

                                
                            </td>
                        </tr>
                         <tr>
                            <td>
                                <span style="margin-left: 5px;">Thời hạn thanh toán tạm ứng</span><br />
                                <asp:TextBox ID="txtthoihan"   runat="server" CssClass="form-control withall"></asp:TextBox>
                               
                                 <asp:RequiredFieldValidator ValidationGroup="Them" ID="RequiredFieldValidator9" runat="server"
                                    ControlToValidate="txtthoihan" ErrorMessage="Nhập thời hạn thanh toán" Display="None"
                                    Text="*"></asp:RequiredFieldValidator>
                                <cc1:CalendarExtender ID="CalendarExtender2" PopupPosition="BottomLeft" runat="server"
                                    TargetControlID="txtthoihan" Format="dd/MM/yyyy">
                                </cc1:CalendarExtender>
                                <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender4" runat="server" FilterType="Custom,Numbers"
                                    TargetControlID="txtthoihan" ValidChars="/-" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                               
                             <asp:Button ID="btnSave" ValidationGroup="Them" runat="server" Style="margin-left: 5px;"
                                    Text="Nộp đơn" CssClass="btn btn-primary" OnClick="btnSave_Click" />
                                <asp:Button ID="btncapnhat" runat="server" Text="Cập nhật" CssClass="btn btn-info"
                                     Visible="false" onclick="btncapnhat_Click" />
                                    <asp:Button ID="btnXoa" runat="server" Text="Xóa đơn" CssClass="btn btn-primary"
                                     Visible="false" onclick="btnXoa_Click" />
                                <asp:Button ID="btnCancel" runat="server" Text="Viết đơn mới" 
                                    CssClass="btn btn-warning" onclick="btnCancel_Click1"
                                   />
                                <asp:Button ID="btnPDF" runat="server" Visible="false" Text="Xuất PDF" 
                                    CssClass="btn btn-info" onclick="btnPDF_Click"  />
                                <asp:Button ID="btnDuyet" runat="server" Visible="false" Text="Phê duyệt" CssClass="btn btn-danger" />
                            </td>
                        </tr>
                    </table>
                    <asp:ValidationSummary ID="ValidationSummary1" HeaderText="Bạn phải nhập các trường sau:"
                        ShowMessageBox="true" ValidationGroup="Them" ShowSummary="false" EnableClientScript="true"
                        runat="server" />
                </div>
            </div>
            <div style="margin: 5px;">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <b>Danh sách đề nghị</b><br />
                         <asp:RadioButton ID="ck1" runat="server" Checked="true" GroupName="s" 
                        Text="Tất cả" oncheckedchanged="ck1_CheckedChanged" AutoPostBack="true"/>&nbsp;&nbsp;
                    <asp:RadioButton ID="ck2" runat="server" GroupName="s" Text="Đã duyệt" 
                        AutoPostBack="true" oncheckedchanged="ck2_CheckedChanged" />&nbsp;&nbsp;
                    <asp:RadioButton ID="ck3" runat="server" GroupName="s" Text="Chưa duyệt"  
                        AutoPostBack="true" oncheckedchanged="ck3_CheckedChanged"/>
                        <asp:RadioButton ID="ck4" runat="server" GroupName="s" Text="Không duyệt"  
                        AutoPostBack="true" oncheckedchanged="ck4_CheckedChanged" />
                    </div>
                     <div style="width: 100%; margin-top: 0px;" class="wrapper">
                        <asp:GridView ID="GVTatca" runat="server" AutoGenerateColumns="false" BackColor="White"
                            BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="1" EmptyDataText="Không có dữ liệu nào"
                            EnableModelValidation="True" ShowFooter="false" CssClass="form-control withall"
                            Width="99%" onrowcommand="GVTatca_RowCommand" >
                            <Columns>
                              
                                 <asp:TemplateField HeaderText="Nhân viên" ItemStyle-HorizontalAlign="Left" ItemStyle-CssClass="padding">
                                    <ItemTemplate>
                                        <asp:LinkButton ID="lbSua" Style="color: #000066;" runat="server" Text='<%#Eval("HoTen") %>'
                                            CommandArgument='<%#Eval("IDs")%>' CommandName="Select" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="lido" ItemStyle-CssClass="padding" HeaderText="Lí do"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" />
                                <asp:BoundField DataField="sotien" HeaderText="Số tiền" ItemStyle-CssClass="padding"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" />
                                <asp:BoundField DataField="tt" HeaderText="Hình thức" ItemStyle-CssClass="padding"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" />
                                <asp:BoundField DataField="thoihan" HeaderText="Thời hạn" ItemStyle-CssClass="padding"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" />
                                    <asp:BoundField DataField="ykien" HeaderText="Ý kiến" ItemStyle-CssClass="padding"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" />
                            </Columns>
                            <FooterStyle BackColor="White" ForeColor="#000066" Font-Bold="True" HorizontalAlign="Left" />
                            <HeaderStyle BackColor="White" Font-Bold="True" ForeColor="Black" Height="30px" />
                            <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
                            <RowStyle BackColor="White" ForeColor="#000066" Height="30px" />
                            <SelectedRowStyle BackColor="Lavender" Font-Bold="false" />
                        </asp:GridView>
                    </div>
                </div>
                    <div style="width: 100%; margin-top: 0px;" class="wrapper">
                        <asp:GridView ID="GV" runat="server" AutoGenerateColumns="false" 
                            BackColor="White" Visible="false" 
                            BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="1" EmptyDataText="Không có dữ liệu nào"
                            EnableModelValidation="True" ShowFooter="false" CssClass="form-control withall"
                            Width="99%" onrowcommand="GV_RowCommand" >
                            <Columns>
                                <asp:TemplateField HeaderText="Xóa" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="50px"
                                    ItemStyle-Width="50px">
                                    <ItemTemplate>
                                        <asp:ImageButton ID="lbXoa" runat="server" Width="20px" Height="20px" ImageUrl="~/img/delete-24.png"
                                            OnClientClick="return confirm('Bạn chắc chắn muốn xóa ?')" CommandArgument='<%#Eval("IDs")%>'
                                            Text="Xóa" CommandName="Del" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                 <asp:TemplateField HeaderText="Nhân viên" ItemStyle-HorizontalAlign="Left" ItemStyle-CssClass="padding">
                                    <ItemTemplate>
                                        <asp:LinkButton ID="lbSua" Style="color: #000066;" runat="server" Text='<%#Eval("HoTen") %>'
                                            CommandArgument='<%#Eval("IDs")%>' CommandName="Select" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="lido" ItemStyle-CssClass="padding" HeaderText="Lí do"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" />
                                <asp:BoundField DataField="sotien" HeaderText="Số tiền" ItemStyle-CssClass="padding"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" />
                                <asp:BoundField DataField="tt" HeaderText="Hình thức" ItemStyle-CssClass="padding"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" />
                                <asp:BoundField DataField="thoihan" HeaderText="Thời hạn" ItemStyle-CssClass="padding"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" />
                            </Columns>
                            <FooterStyle BackColor="White" ForeColor="#000066" Font-Bold="True" HorizontalAlign="Left" />
                            <HeaderStyle BackColor="White" Font-Bold="True" ForeColor="Black" Height="30px" />
                            <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
                            <RowStyle BackColor="White" ForeColor="#000066" Height="30px" />
                            <SelectedRowStyle BackColor="Lavender" Font-Bold="false" />
                        </asp:GridView>
                    </div>
                </div>
                <asp:HiddenField ID="hdID" runat="server" />
                     <div style="width: 100%; margin-top: 0px;" class="wrapper">
                        <asp:GridView ID="GVDaDuyet" runat="server" AutoGenerateColumns="false" 
                             BackColor="White" Visible="false" 
                            BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="1" EmptyDataText="Không có dữ liệu nào"
                            EnableModelValidation="True" ShowFooter="false" CssClass="form-control withall" 
                            Width="99%" onrowcommand="GVDaDuyet_RowCommand" >
                            <Columns>
                               
                                <asp:TemplateField HeaderText="Nhân viên" ItemStyle-HorizontalAlign="Left" ItemStyle-CssClass="padding">
                                    <ItemTemplate>
                                        <asp:LinkButton ID="lbSua" Style="color: #000066;" runat="server" Text='<%#Eval("HoTen") %>'
                                            CommandArgument='<%#Eval("IDs")%>' CommandName="Select" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="lido" ItemStyle-CssClass="padding" HeaderText="Lí do"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" />
                                <asp:BoundField DataField="sotien" HeaderText="Số tiền" ItemStyle-CssClass="padding"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" />
                                <asp:BoundField DataField="tt" HeaderText="Hình thức" ItemStyle-CssClass="padding"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" />
                                <asp:BoundField DataField="thoihan" HeaderText="Thời hạn" ItemStyle-CssClass="padding"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" />
                                    <asp:BoundField DataField="ykien" HeaderText="Ý kiến" ItemStyle-CssClass="padding"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" />
                            </Columns>
                            <FooterStyle BackColor="White" ForeColor="#000066" Font-Bold="True" HorizontalAlign="Left" />
                            <HeaderStyle BackColor="White" Font-Bold="True" ForeColor="Black" Height="30px" />
                            <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
                            <RowStyle BackColor="White" ForeColor="#000066" Height="30px" />
                            <SelectedRowStyle BackColor="Lavender" Font-Bold="false" />
                        </asp:GridView>
                        <asp:GridView ID="GVKhongDuyet" runat="server" AutoGenerateColumns="false" 
                             BackColor="White" Visible="false" 
                            BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="1" EmptyDataText="Không có dữ liệu nào"
                            EnableModelValidation="True" ShowFooter="false" CssClass="form-control withall" 
                            Width="99%"  onrowcommand="GVTatca_RowCommand">
                            <Columns>
                               
                                <asp:TemplateField HeaderText="Nhân viên" ItemStyle-HorizontalAlign="Left" ItemStyle-CssClass="padding">
                                    <ItemTemplate>
                                        <asp:LinkButton ID="lbSua" Style="color: #000066;" runat="server" Text='<%#Eval("HoTen") %>'
                                            CommandArgument='<%#Eval("IDs")%>' CommandName="Select" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="lido" ItemStyle-CssClass="padding" HeaderText="Lí do"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" />
                                <asp:BoundField DataField="sotien" HeaderText="Số tiền" ItemStyle-CssClass="padding"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" />
                                <asp:BoundField DataField="tt" HeaderText="Hình thức" ItemStyle-CssClass="padding"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" />
                                <asp:BoundField DataField="thoihan" HeaderText="Thời hạn" ItemStyle-CssClass="padding"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" />
                                    <asp:BoundField DataField="ykien" HeaderText="Ý kiến" ItemStyle-CssClass="padding"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" />
                            </Columns>
                            <FooterStyle BackColor="White" ForeColor="#000066" Font-Bold="True" HorizontalAlign="Left" />
                            <HeaderStyle BackColor="White" Font-Bold="True" ForeColor="Black" Height="30px" />
                            <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
                            <RowStyle BackColor="White" ForeColor="#000066" Height="30px" />
                            <SelectedRowStyle BackColor="Lavender" Font-Bold="false" />
                        </asp:GridView>
                    </div>
                </div>
                    <div style="width: 100%; margin-top: 0px;" class="wrapper">
                        
                    </div>
                   
                </div>
            </div>
             <cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" CancelControlID="btnExit"
                Drag="True" BackgroundCssClass="modalBackground" PopupControlID="pnPopup" TargetControlID="btnDuyet"
                RepositionMode="RepositionOnWindowResize">
            </cc1:ModalPopupExtender>
            <asp:Panel ID="pnPopup" runat="server" Style="display: none; width: 80%;">
                <div style="background-image: url('img/content.png'); background-repeat: repeat;
                    box-shadow: 5px 5px 5px #888; border-radius: 10px; border: 1px solid #6EA1C0;
                    margin-top: -10px;">
                    <div style="background-color: #5B5B5B; color: White; font-weight: bold; border-radius: 5px 5px 0px 0px;
                        width: 100%; text-align: center; line-height: 26px; overflow: hidden;">
                        PHÊ DUYỆT VĂN BẢN
                    </div>
                    <div style="margin: 5px;">
                        <table width="99%">
                            <tr>
                                <td>
                                    Kết luận&nbsp;&nbsp;
                                    <asp:RadioButton runat="server" ID="rdDat" Text="Duyệt" GroupName="duyet" Checked="true" />
                                    <asp:RadioButton runat="server" ID="rdKhongDat" Text="Không duyệt" GroupName="duyet" />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Lý do<br />
                                    <asp:TextBox ID="txtNoiDung" runat="server" CssClass="form-control withall" TextMode="MultiLine"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Button ID="btnLuu"   runat="server" Style="margin-left: 5px;" 
                                        Text="Lưu lại" CssClass="btn btn-primary" onclick="btnLuu_Click"
                                        />
                                    <asp:Button ID="btnExit" runat="server" Text="Hủy bỏ" CssClass="btn btn-warning" />
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
            </asp:Panel>
        </ContentTemplate>
        <Triggers>
            <asp:PostBackTrigger ControlID="btnPDF" />
        </Triggers>
    </asp:UpdatePanel>
</asp:Content>
